﻿using SqlMapper.SqlElements;
using System.Collections.Specialized;
using System.Xml;

namespace SqlMapper.Serializers
{
    public sealed class IsGreaterThanDeSerializer : IDeSerializer
    {
        public BaseTag Deserialize(XmlNode node)
        {
            IsGreaterThan isGreaterThan = new IsGreaterThan();

            NameValueCollection prop = NodeUtils.ParseAttributes(node);
            isGreaterThan.Prepend = NodeUtils.GetStringAttribute(prop, "prepend");
            isGreaterThan.Property = NodeUtils.GetStringAttribute(prop, "property");
            isGreaterThan.CompareProperty = NodeUtils.GetStringAttribute(prop, "compareProperty");
            isGreaterThan.CompareValue = NodeUtils.GetStringAttribute(prop, "compareValue");
            isGreaterThan.Sql = NodeUtils.GetStringAttribute(prop, "sql");

            return isGreaterThan;
        }
    }
}
